import request from '@/utils/request'

export default {
  update(category) {
    return request({
      url: '/category/update',
      method: 'post',
      data: category
    });
  },
  deletePro(proid) {
    return request({
      url: '/category/delete',
      method: 'delete',
      params: {
        "id":proid
      }
    });
  },
  list(pageInfo) { // 列表
    return request({
      url: '/category/list',
      method: 'get',
      params: {
        currentPage: pageInfo.currentPage,
        pageSize: pageInfo.pageSize,
        key: pageInfo.key
      }
    });
  },
  //新增
  add(category) {
    return request({
      url: '/category/add',
      method: 'post',
      data: {
        categoryName: category.categoryName,
        description: category.description,
      }
    });
  },
  deleteBatch(ids) {  
    return request({
      url: '/category/deleteBatch',
      method: 'delete',
      data: ids
    })
  },
  getAllCategories() {
    return request({
      url: '/category/all',
      method: 'get'
    })
  },
  getById(categoryId) {
    return request({
      url: '/category/getById/' + categoryId,
      method: 'get',
    });
  },
}